package com.olt.config;
import com.olt.wapper.AccessRequestWrapper;
import com.olt.wapper.AccessResponseWrapper;


import javax.servlet.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//@WebFilter(filterName = "accessLog", urlPatterns = "/api/*")
public class AccessFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
      AccessRequestWrapper requestWrapper = new AccessRequestWrapper((HttpServletRequest) servletRequest);
      AccessResponseWrapper responseWrapper = new AccessResponseWrapper((HttpServletResponse) servletResponse);
      filterChain.doFilter(requestWrapper, responseWrapper);

    }

    @Override
    public void destroy() {

    }
}
